package com.cy.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cy.common.vo.Carts;
import com.cy.common.vo.JsonResult;
import com.cy.service.SysCartService;

/**  
 * @Title:  SysCartController.java   
 * @Package com.cy.controller   
 * @Description:    描述   
 * @author: ZHANGSIMIN     
 * @date:   2019年10月22日 上午10:26:23   
 * @version V1.3 
 */
@Controller
@RequestMapping("/Cart/")
public class SysCartController {
	
	@Autowired
	private SysCartService sysCartService;
	
	@RequestMapping("getList")
	@ResponseBody
	public JsonResult getCartListByUserid(Integer id) {
		List<Carts> cartsByUserid = sysCartService.getCartsByUserid(id);
		JsonResult re = new JsonResult(cartsByUserid);
		re.setMessage(cartsByUserid.size()+"");
		return re;
	}
	
	@RequestMapping("deleteCartsByCartId")
	@ResponseBody
	public JsonResult deleteCartsByCartId(Integer id) {
		Integer rows = sysCartService.deleteCartsByCartId(id);
		return new JsonResult(rows);
	}
}
